<!-- 新增分区 -->
<template>
  <div class="pad-out-box">
    <el-table :border="true" :data="tableData">
      <el-table-column align="center" label="更新项" prop="fieldName"></el-table-column>
      <el-table-column align="center" label="更新前" prop="valueBefore" />
      <el-table-column align="center" label="更新后" prop="valueAfter" />
      <el-table-column align="center" label="更新来源" prop="contractName"></el-table-column>
      <el-table-column align="center" label="生效时间">
        <template slot-scope="scope">
          <span>{{ scope.row.createTime | formatDateTime('YYYY-MM-DD') }}</span>
        </template>
      </el-table-column>
    </el-table>
    <Pagination @change="pageChange" :total="total" />
  </div>
</template>
<script>
  import { apiContractLog } from '../../../api/contract';

  export default {
    data() {
      return {
        tableData: [],
        currentPage:1,
        pageSize:10,
        total:0
      };
    },

    mounted() {
      this.getList();
    },

    methods: {
      async getList(type) {
        let res = await apiContractLog({
          contractKey: this.$route.query.contractKey,
          pageSize: this.pageSize,
          currentPage: type ? this.currentPage : 1,
        });
        this.tableData = res.rows || [];
        this.total = res.total | 0
      },
      //下载
      uploadLoad(url) {
        let a = document.createElement('a');
        a.style.display = 'none';
        a.href = url;
        document.body.appendChild(a);
        a.click();
        document.body.removeChild(a);
      },
      //分页
      pageChange(e) {
        this.currentPage = e.currentPage;
        this.pageSize = e.pageSize;
        this.getList('more');
      },
    },
  };
</script>
<style lang="scss" scoped></style>
